/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.openbrew.openbrewrf;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author chapmand
 */
@Entity
@Table(name = "MaltBill")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "MaltBill.findAll", query = "SELECT m FROM MaltBill m"),
    @NamedQuery(name = "MaltBill.findByMaltBillID", query = "SELECT m FROM MaltBill m WHERE m.maltBillID = :maltBillID"),
    @NamedQuery(name = "MaltBill.findByMaltPercent", query = "SELECT m FROM MaltBill m WHERE m.maltPercent = :maltPercent"),
    @NamedQuery(name = "MaltBill.findByMaltLbs", query = "SELECT m FROM MaltBill m WHERE m.maltLbs = :maltLbs")})
public class MaltBill implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "maltBillID")
    private Integer maltBillID;
    @Basic(optional = false)
    @NotNull
    @Column(name = "maltPercent")
    private float maltPercent;
    @Basic(optional = false)
    @NotNull
    @Column(name = "maltLbs")
    private float maltLbs;
    @JoinColumn(name = "maltID", referencedColumnName = "MaltID", nullable=true)
    @ManyToOne(optional = true)
    private Malt maltID;

    public MaltBill() {
    }

    public MaltBill(Integer maltBillID) {
        this.maltBillID = maltBillID;
    }

    public MaltBill(Integer maltBillID, float maltPercent, float maltLbs) {
        this.maltBillID = maltBillID;
        this.maltPercent = maltPercent;
        this.maltLbs = maltLbs;
    }

    public Integer getMaltBillID() {
        return maltBillID;
    }

    public void setMaltBillID(Integer maltBillID) {
        this.maltBillID = maltBillID;
    }

    public float getMaltPercent() {
        return maltPercent;
    }

    public void setMaltPercent(float maltPercent) {
        this.maltPercent = maltPercent;
    }

    public float getMaltLbs() {
        return maltLbs;
    }

    public void setMaltLbs(float maltLbs) {
        this.maltLbs = maltLbs;
    }

    public Malt getMaltID() {
        return maltID;
    }

    public void setMaltID(Malt maltID) {
        this.maltID = maltID;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (maltBillID != null ? maltBillID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MaltBill)) {
            return false;
        }
        MaltBill other = (MaltBill) object;
        if ((this.maltBillID == null && other.maltBillID != null) || (this.maltBillID != null && !this.maltBillID.equals(other.maltBillID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.openbrew.openbrewrf.MaltBill[ maltBillID=" + maltBillID + " ]";
    }
    
}
